package org.zhongyin.DesignPattern.AbstractFactory;

public class AbstractFactoryMain {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		AbstractFactory colorFactory = FactoryProducer.getFactory("Color");
		Color color1 = colorFactory.getColor("Red");
		color1.fill();
		
		Color color2 = colorFactory.getColor("Green");
		color2.fill();
		
		Color color3 = colorFactory.getColor("Yellow");
		color3.fill();
		
		AbstractFactory shapeFactory = FactoryProducer.getFactory("Shape");
		//get an object of Shape Circle
	      Shape shape1 = shapeFactory.getShape("CIRCLE");

	      //call draw method of Shape Circle
	      shape1.draw();

	      //get an object of Shape Rectangle
	      Shape shape2 = shapeFactory.getShape("RECTANGLE");

	      //call draw method of Shape Rectangle
	      shape2.draw();
	      
	      //get an object of Shape Square 
	      Shape shape3 = shapeFactory.getShape("SQUARE");

	      //call draw method of Shape Square
	      shape3.draw();
	}

}
